<!DOCTYPE html>
<html lang="en">

    <head>
        <title><?= $page ?> | <?= $title ?></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <link rel="stylesheet" href="<?= base_url(); ?>assets/css/jquery-ui-1.8.16.custom.css" />
        <link rel="stylesheet" href="<?= base_url(); ?>assets/css/bootstrap.css" />
        <style>
            body {
                padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
            } 
        </style>   
        <!--[if IE]>
        <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>assets/css/jquery.ui.1.8.16.ie.css"/>
        <![endif]-->
        <link rel="stylesheet" href="<?= base_url(); ?>assets/css/bootstrap-responsive.css"> 
        <link rel="stylesheet" href="<?= base_url(); ?>assets/css/style.css">

        <!-- VARS to JS -->
        <script type="text/javascript">
            var base_url = '<?= base_url() ?>';
            var site_url = '<?= site_url() ?>';
            var page = '<?= $page ?>';

        </script> 

        <script type="text/javascript" src="<?= base_url(); ?>assets/js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="<?= base_url(); ?>assets/js/bootstrap.js"></script>
        <script type="text/javascript" src="<?= base_url(); ?>assets/js/jquery.validate.js"></script>

        <!--TINY MCE EDITOR-->
<!--        <script src="<?= base_url() ?>assets/js/qtrans/editor.js" type="text/javascript"></script>-->


        <link media="all" type="text/css" href="<?= base_url(); ?>assets/css/editor-buttons.css" id="editor-buttons-css" rel="stylesheet">

        <link href="<?= base_url() ?>assets/css/qtrans.css" rel="stylesheet" type="text/css">

        <? if($_GET['post_type'] == 'gallery' OR $_GET['post_type'] == 'document'): ?>  

                <!--Jquery UI-->
                <!--<link href="<?= base_url() ?>assets/css/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css">-->
                <!--<script type="text/javascript" src="<?= base_url(); ?>assets/js/jquery-ui-1.8.5.custom.min.js"></script> -->

                <!--PLUPLOAD UPLOAD-->
                <script type="text/javascript" src="<?= base_url() ?>assets/js/plupload/plupload.full.js"></script>

                <!--LIGHTBOX-->
                <link href="<?= base_url() ?>assets/css/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css">
                <script type="text/javascript" src="<?= base_url() ?>assets/js/jquery.lightbox-0.5.min.js"></script>

            <? endif; ?>  

        <? if($_GET['post_type'] == 'words'): ?>
                <!--Datatable-->
                <link href="<?= base_url() ?>assets/css/demo_table_jui.css" rel="stylesheet" type="text/css">
                <script type="text/javascript" src="<?= base_url() ?>assets/js/jquery.dataTables.min.js"></script>
            <? endif; ?>         

        <script type="text/javascript">
            jQuery(document).ready(function() {

                jQuery('#flags a').live('click',function(){ 

                    $.ajax({
                        url: base_url+'home/my_language',
                        dataType: 'json',
                        type: "POST",
                        data: {my_language:jQuery(this).attr('rel')},
                        success: function (data) {
                            window.location.reload()
                        },
                        error: function (xhr, textStatus, errorThrown) {
                            alert('Error ocured...\n Server not found.');
                        }
                    });

                })
            })
        </script>
    </head>

    <body>

        <?= $this->load->view('_nav'); ?>

        <?php echo $template['body']; ?>

        <div class="container"><div id="footer"><p>&copy; 2012 NU SIT Bar - CMS PRO </p></div></div>

        <!--<script type="text/javascript" src="<?= base_url(); ?>assets/js/libs/jquery-ui.min.js"></script>-->
        <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>



        <script src="<?= base_url() ?>assets/js/tinymce/tiny_mce.js" type="text/javascript"></script>
        <script type="text/javascript">

            tinyMCE.init({
                mode : "textareas",
                theme : "advanced",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "bottom",
                theme_advanced_resizing : false,
                relative_urls:false,
                remove_script_host:false,
                convert_urls:false,
                remove_linebreaks:true,
                gecko_spellcheck:true,
                keep_styles:false,
                entities:"38,amp,60,lt,62,gt",
                accessibility_focus:true,
                tabfocus_elements:"major-publishing-actions",
                media_strict:false,
                paste_remove_styles:true,
                paste_remove_spans:true,
                paste_strip_class_attributes:"all",
                paste_text_use_dialog:true,
                extended_valid_elements:"article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr",
                wpeditimage_disable_captions:false,
                plugins:"lists,inlinepopups,paste,directionality,xhtmlxtras,spellchecker,tabfocus,paste,media",
                content_css:base_url+"assets/css/editor-style.css",
                elements:"content",
                wpautop:true,
                apply_source_formatting:false,
                theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker,|,formatselect,forecolor,|,pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo",
                theme_advanced_buttons2:"",
                theme_advanced_buttons3:"",
                theme_advanced_buttons4:""

            });
        </script>

        <?
            switch($this->router->fetch_class())
            {

                case 'objects':

                    switch($this->router->method)
                    {

                        case ($this->router->method == 'view_edit' || $this->router->method == 'view_new'):
                            ?>
                            <script src="<?= base_url() ?>assets/js/realestate/helper.js" type="text/javascript"></script> <!--helper methods-->
                            <script src="<?= base_url() ?>assets/js/realestate/edit_general.js" type="text/javascript"></script>
                            <script src="<?= base_url() ?>assets/js/realestate/edit_attributes.js" type="text/javascript"></script>
                            <script src="<?= base_url() ?>assets/js/realestate/add_attribute_on_group.js" type="text/javascript"></script>
                            <script src="<?= base_url() ?>assets/js/realestate/new_attribute.js" type="text/javascript"></script>
                            <?
                            break;

                        case ($this->router->method == 'view'):
                            ?>

                            <?
                            break;
                    }
            }

            if($this->router->fetch_class() == 'object_info' && $this->router->method == 'view'):
                ?>
                <script src="<?= base_url() ?>assets/js/realestate/helper.js" type="text/javascript"></script> <!--helper methods-->
                <script type="text/javascript" src="<?= base_url() ?>assets/js/realestate/edit_info.js"></script>
                <?
            endif;


            if($this->router->fetch_class() == 'object_gallery' && $this->router->method == 'view'):
                ?>
                <script type="text/javascript" src="<?= base_url() ?>assets/js/plupload/plupload.full.js"></script>

                <!--LIGHTBOX-->
                <link href="<?= base_url() ?>assets/css/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css">
                <script type="text/javascript" src="<?= base_url() ?>assets/js/jquery.lightbox-0.5.min.js"></script>
                <script src="<?= base_url() ?>assets/js/realestate/upload.js" type="text/javascript"></script>
                <script src="<?= base_url() ?>assets/js/realestate/init_lightbox.js" type="text/javascript"></script>
            <? endif;
        ?>

        <? if($this->router->fetch_class() == 'objects'): ?>

                <script src="<?= base_url() ?>assets/js/realestate/init.js" type="text/javascript"></script>

            <? endif; ?>

    </body>

</html>
